author: JD Long date: 2018-10-26 autosize: true font-family: ‘Helvetica’ css: custom.css
class: small-code
* I am sharing my personal views not the views of RenaissanceRe Holdings, Ltd. or any of its subsidiary companies.
* Thought provoking only: The materials are provided for information purposes only, are in summary form, and thus do not include all information necessary for analysis.
* This is not consulting: No representations or warranties are give as to the accuracy or completeness of the materials and no professional advice or guidance is given by the presentation. If you want to use these ideas, professional consultation should be sought.
* This is not financial advice: No financial advice is being given nor any recommendation to invest in any financial product. Historical data is no assurance as to future results.
class: small-body
All data, code, and examples: CerebralMastication/Presentations
Take Pix, Dance, Ask, Tweet @cmastication
class: medium-body
– Obligatory XKCD
– Key Point: R Fits into Corporate Reporting
– R in Corporate Reporting Fits Better if You’re Not an Asshole (empathy!)
– 3 Easy Tricks to Try Tonight to Make Your Reporting Hotter
class: medium-body
– All time is of equal value and is interchangeable
class: medium-body
– All time is of equal value and is interchangeable
– Current frequency of reporting = future freq
class: medium-body
– All time is of equal value and is interchangeable
– Current frequency of reporting = future freq
– All activities are of equal utility (nothing sucks your will to live!)
class: medium-body
– All time is of equal value and is interchangeable
– Current frequency of reporting = future freq
– All activities are of equal utility (nothing sucks your will to live!)
– Automated and manual workflows produce the same product (errors?)
======================================================== class: medium-body
It looks like you’re doing a data science!Would you like me to format your integers as dates?!?
class: medium-body
– Use R Studio Project structure (or here package)
class: medium-body
– Use R Studio Project structure (or here package)
– Keep all files in sub directories in relative paths
class: medium-body
– Use R Studio Project structure (or here package)
– Keep all files in sub directories in relative paths
– Naming convention - make it sort right
class: medium-body
– Use R Studio Project structure (or here package)
– Keep all files in sub directories in relative paths
– Naming convention - make it sort right
– Sub Directories: make it easy to grok
class: medium-body
– Use R Studio Projects (or here package)
– Keep all files in relative paths
– Naming convention: sorting
– Sub Directories: easy to grok
– Passwords in environ variables
class: medium-body
– Markdown File (*.Rmd) - minimal
– Sourced R script (*.R) - most here
– Package: if used more than 2 times
class: small-body
– Params - Knitr YAML - For easy maintenance
– Worded package by David Gohel - Page Breaks and page orientation hacks
– Flextable package by David Gohel - Table formatting controls
– Officer package by (guess who?) David Gohel! - more table formatting
---
title: "My Amazing Report"
output:
worded::rdocx_document:
reference_docx: 10_amazing_report_template.docx
toc: false
toc_depth: 2
date: '2018-10-26'
params:
main: 'mycompany 2018-10-01'
compare: 'mycompany 2018-07-01'
---
Whatsit look like?
========================================================
```{r, include=FALSE} library(flextable) library(our_kickass_corp_package)
my_corp_db_con <- our_db_connect(Sys.getenv(‘MYUID’), Sys.getenv(‘MYPWD’)) ````
class: small-code
regulartable(my_cars) %>%
color(i = 1, color = "#003e51", part = "header") %>%
autofit %>%
theme_zebra(odd_header = "transparent",
even_header = "transparent") %>%
fontsize(size = 9, part = 'all') %>%
border_outer(
border = officer::fp_border(color = "gray70",
width = 2),
part = "all") %>%
align(align = "center", part = 'header') %>%
align(j = 1, align = "right", part = 'body') %>%
align(j = 2:4, align = "center", part = 'body') %>%
class: small-code
set_formatter(
`mpg` = function(x)
formatC(x,
digits = 1,
format = "f",
big.mark = ","),
)
`markdown{r, echo=FALSE, dpi=300, fig.width=5, fig.height=2.9}
class: small-code `markdown{r, echo=FALSE} my_groups <- unique(mtcars$cyl) out <- list() for (group in my_groups){ out = c(out, knitr::knit_child(‘10_sub.Rmd’)) } ``` Children are evaluated in the context (namespace etc.) of the parent
`r paste(out, collapse='\n')`
library(openxlsx)
xlfile <- 'my_junk.xlsx'
wb <- loadWorkbook(xlfile)
removeTable(wb=wb, sheet='Sheet1', table="our_table")
writeDataTable(
wb, sheet='Sheet1', x=my_df,
tableName="our_table",
startCol=3, startRow=10
)
saveWorkbook(wb=wb, file=xlfile,
overwrite = TRUE)
class: small-body
Github: CerebralMastication/Presentations
Twitter: @cmastication Email: jdlong@gmail.com